import type { CourseItem } from './course'
import type { ResourceItem } from './resource'

export interface UserInfo {
    id: number
    account: string
    role_id: number
    first_name: string
    last_name: string
    first_initial: string
    last_initial: string
    email: string
    show_email_type: string
    moodlenet_account: string
    city_address: string
    country: string
    timezone: string
    introduction: string
    code: string
    avatar_url: string
    avatar_description: string
    interests: string[]
    phone_number: string
    mobile_number: string
    detailed_address: string
    department: string
    institution: string
    additional_last_name: string
    additional_first_name: string
    additional_first_initial: null
    additional_last_initial: null
    additional_middle_name: string
    additional_alias: string
    status: number
    last_login_time: string
    creator_id: number
    created_at: string
    updated_at: string
    courses: CourseItem[]
}

export interface UserCreateItem {
    account: string
    password: string
    role_id: number
    first_name: string
    last_name: string
    email: string
    show_email_type: number
    city_address: string
    country: string
    timezone: string
    introduction: string
    code: string
    avatar_url: string
    avatar_description: string
    interests: string[]
    phone_number: string
    mobile_number: string
    detailed_address: string
    institution: string
    department: string
    additional_last_name: string
    additional_first_name: string
    additional_alias: string
}

export interface ImportResult {
    total: number
    success: number
    failed: number
    data: ImportResultItem[]
}

export interface ImportResultItem {
    account: string
    role_id: number
    role_name: string
    first_name: string
    last_name: string
    email: string
    status: string
}

export interface CourseMember {
    id: number
    avatar_url: string
    code: string
    email: string
    first_name: string
    last_name: string
    role: string
    role_id: number
}

export interface BasePreference<T, K extends string> {
    id: number
    user_id: number
    key: K
    value: T
    description: string
}

// S 偏好
export interface CalendarPreferencesValue {
    time_format: string
    week_start: string
    max_events: string
    show_days: string
    remember_filters: string
}

export interface DiscussionPreferencesValue {
    auto_subscribe: string
    email_digest_type: string
    use_nested_discussions: boolean
    track_forums: string
    notify_on_post: string
}

export interface MessagePreferencesValue {
    who_can_send_message: number
    isEmail: boolean
    isDevice: boolean
    use_input_key: number
}

export interface ResourcePreferencesValue {
    default_content_visibility: string
}

export type CalendarPreference = BasePreference<CalendarPreferencesValue, 'calendar_preferences'>
export type DiscussionPreference = BasePreference<DiscussionPreferencesValue, 'discussion_preferences'>
export type EditorPreference = BasePreference<string, 'editor_preferences'>
export type LanguagePreference = BasePreference<string, 'language'>
export type MessagePreference = BasePreference<MessagePreferencesValue, 'message_preferences'>
export type ResourcePreference = BasePreference<ResourcePreferencesValue, 'resource_preferences'>

export interface UserPreferences {
    calendar_preferences: CalendarPreference
    discussion_preferences: DiscussionPreference
    editor_preferences: EditorPreference
    language: LanguagePreference
    message_preferences: MessagePreference
    resource_preferences: ResourcePreference
}
// E 偏好

// 通知消息
export interface noticesItem {
    id: number
    student_id: number
    status: number
    content: string
    creator_id: number
    created_at: string
    updated_at: string
    deleted_at: number

}
